<template>
  <swiper>
    <swiper-item v-for="(item, id) in banners" :key="id">
      <a :href="item.link">
        <img :src="item.image" @load="imgLoad" />
      </a>
    </swiper-item>
  </swiper>
</template>
<script>
import { Swiper, SwiperItem } from "components/common/swiper";
export default {
  name: "HomeSwiper",
  components: {
    Swiper,
    SwiperItem,
  },
  props: {
    banners: {
      type: Array,
    },
  },
  data() {
    return {
      isLoad: false,
    }; 
  },
  methods: {
    imgLoad() {
      //加载一次就可以
      if (!this.isLoad) {
        this.$emit('swipperImgLoad')
        this.isLoad = true;
      }
    },
  },
};
</script>
<style>
</style>